package com.pega.eprescription.activity;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.preference.SwitchPreference;

import com.pega.eprescription.R;
import com.pega.eprescription.pref.Prefs;

public class SettingActivity extends PreferenceActivity {

	EditTextPreference editTextPreference;

	protected ProgressDialog pro_dialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.prefs_setting);
		editTextPreference = (EditTextPreference) findPreference("ObserverPhone");
		editTextPreference.setSummary(Prefs.sharedInstance(this)
				.getObserverPhone());
		editTextPreference
				.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

					@Override
					public boolean onPreferenceChange(Preference arg0,
							Object arg1) {
						Prefs.sharedInstance(SettingActivity.this)
								.updateObserverPhone((String) arg1);
						editTextPreference.setSummary((String) arg1);
						return false;
					}
				});

		

	}

	@Override
	protected void onResume() {
		editTextPreference.setSummary(Prefs.sharedInstance(this)
				.getObserverPhone());
		super.onResume();
	}
}
